package io.r2mo.test.common.controller.gen.productcat;

import io.r2mo.test.common.service.gen.productcat.IProductCatServiceV1;
import io.r2mo.test.common.domain.ProductCatEntity;
import io.r2mo.spring.common.webflow.BaseController;
import io.r2mo.typed.common.Pagination;
import io.r2mo.typed.json.JObject;
import io.r2mo.typed.webflow.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * ProductCat Controller接口
 * </p>
 *
 * @author lang
 * @since 2025-09-22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/v1/productcat")
public class ProductCatCrudControllerV1 extends BaseController<ProductCatEntity, ProductCatCommonRequest, ProductCatCommonResponse> implements ProductCatCrudController {

    @Autowired
    private IProductCatServiceV1 service;

    @Override
    protected IProductCatServiceV1 service() {
        return this.service;
    }

    @Override
    protected ProductCatCommonResponse createResponse() {
        return new ProductCatCommonResponse();
    }

    @Override
    protected ProductCatCommonRequest createRequest() {
        return new ProductCatCommonRequest();
    }

    // POST /v1/productcat
    @Override
    public R<ProductCatCommonResponse> createSingle(final ProductCatCommonRequest request) {
        return super.createSingle(request);
    }

    // PUT /v1/productcat/{id}
    @Override
    public R<ProductCatCommonResponse> updateSingle(final String id, final ProductCatCommonRequest request) {
        return super.updateSingle(id, request);
    }

    // GET /v1/productcat/{id}
    @Override
    public R<ProductCatEntity> findSingle(final String id) {
        return super.findSingle(id);
    }

    // DELETE /v1/productcat/{id}
    @Override
    public R<Boolean> removeSingle(final String id) {
        return super.removeSingle(id);
    }

    // POST /v1/productcat/search
    @Override
    public R<Pagination<ProductCatEntity>> findPage(final JObject query) {
        return super.findPage(query);
    }

    // GET /v1/productcat/all
    @Override
    public R<List<ProductCatEntity>> findAll() {
        return super.findAll();
    }

    // POST /v1/productcat/import
    @Override
    public R<Boolean> uploadData(final MultipartFile file, final JObject config) {
        return super.uploadData(file, config);
    }

    // POST /v1/productcat/export
    @Override
    public void downloadBy(final JObject query) {
        super.downloadBy(query);
    }
}